package com.runing.controller;


import com.runing.config.ResponseWrapper;
import com.runing.entity.RRule;
import com.runing.service.impl.RRuleServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lel
 * @since 2021-03-11
 */
@RestController
@RequestMapping("/rRule")
@Api(tags = "每周次数和距离规则设置")
public class RRuleController {
    @Autowired
    RRuleServiceImpl ruleService;

    @ApiOperation("查询所有计分规则")
    @GetMapping("/Semester")
    public ResponseWrapper findAllRule(){
        ResponseWrapper wrapper = ruleService.findAllRules();
        return wrapper;
    }

    @ApiOperation("修改距离和次数")
    @PutMapping("/updateRule")
    public ResponseWrapper updateRule(@RequestBody List<RRule> ruleList){
        ResponseWrapper wrapper = ruleService.updateRule(ruleList);
        return wrapper;
    }


}

